package wk.springtest.mvc;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class AlaController {

    @RequestMapping("/ala.htm")
    public ModelAndView alaMaKota(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        String aMessage = "Ala ma kota!";
        
        System.out.println("- ala -");

        ModelAndView modelAndView = new ModelAndView("/resources/view/ala.html");
        modelAndView.addObject("message", aMessage);

        return modelAndView;
    }
    
    @RequestMapping("/ola.htm")
    public ModelAndView olaMaPsa(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        
        String aMessage = "Ola ma kota!";
        
        System.out.println("- ola -");
        
        ModelAndView modelAndView = new ModelAndView("/resources/view/ola.html");
        modelAndView.addObject("message", aMessage);
        
        return modelAndView;
    }
}
